#include "buffer64.h"


void buffer64_init(buffer64* buffer)
{
  buffer->wp = 0;
  buffer->rp = 0;
}

int buffer64_full(buffer64* buffer)
{
  return (buffer->wp + 1) % 64 == buffer->rp;
}

int buffer64_empty(buffer64* buffer)
{
  return buffer->wp == buffer->rp;
}

void buffer64_insert(buffer64* buffer, char c)
{
  buffer->buf[buffer->wp] = c;
  buffer->wp = (buffer->wp + 1) % 64;
}

char buffer64_remove(buffer64* buffer)
{
  char c = buffer->buf[buffer->rp];
  buffer->rp = (buffer->rp + 1) % 64;
  return c;
}
